package com.ziki.test.crypto;

public class Base64 {
    public static String base64encode(byte[] data) {
        String str = null;
        if (data != null) {
            return (new sun.misc.BASE64Encoder()).encode(data);
        }
        return str;
    }
    
    public static byte[] base64decode(String str) {
        byte[] data = null;
        if (str != null && !str.equals("")) {
            try {
                return (new sun.misc.BASE64Decoder()).decodeBuffer(str);
            } catch (Exception ex) {
                data = null;
            }
        }
        return data;
    }
}
